import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)

const routes = [
  // {
  //   path: '/login',
  //   name: 'Login',
  //   component: () => import('@/views/login/Login.vue')，
  // redirect: '/',
  // },
  {
    path: '/',
    name: 'Layout',
    component: () => import('@/views/layout/index.vue'),
    children: [
      {
        // 默认 显示home组件
        path: '',
        name: 'Home',
        component: () => import('@/views/home/Home.vue')
      },
      {
        path: '/home',
        name: 'Home',
        text: '首页',
        component: () => import('@/views/home/Home.vue')
      },
      {
        path: '/cesiumContainer',
        name: 'cesiumContainer',
        text: '自定义事件',
        component: () => import('@/views/cesium/CesiumContainer.vue')
      },
      {
        path: '/videosEarth',
        name: 'videosEarth',
        text: '视频纹理',
        component: () => import('@/views/cesium/videosEarth/videosEarth.vue')
      },
      {
        path: '/entityRectEarth',
        name: 'entityRectEarth',
        text: '半透明矩形',
        component: () => import('@/views/cesium/entityRectEarth/entityRectEarth.vue')
      },
      {
        path: '/ranging',
        name: 'ranging',
        text: 'TODO:测量',
        component: () => import('@/views/cesium/ranging/ranging.vue')
      },
      {
        path: '/skyBox',
        name: 'skyBox',
        text: '天空盒子',
        component: () => import('@/views/cesium/skyBox/skyBox.vue')
      },
      {
        path: '/graphicCombination',
        name: 'graphicCombination',
        text: '原始图形组合',
        component: () => import('@/views/cesium/graphicCombination/graphicCombination.vue')
      },
      {
        path: '/dynamicCZML',
        name: 'dynamicCZML',
        text: '动态CZML',
        component: () => import('@/views/cesium/dynamicCZML/dynamicCZML.vue')
      },
      {
        path: '/billboard',
        name: 'billboard',
        text: '广告牌',
        component: () => import('@/views/cesium/billboard/billboard.vue')
      },
      {
        path: '/dynamicBillboard',
        name: 'dynamicBillboard',
        text: '动态广告牌',
        component: () => import('@/views/cesium/dynamicBillboard/dynamicBillboard.vue')
      },
      {
        path: '/bubbleCartridge',
        name: 'bubbleCartridge',
        text: 'TODO:气泡弹框',
        component: () => import('@/views/cesium/bubbleCartridge/bubbleCartridge.vue')
      },
      {
        path: '/dynamicColor',
        name: 'dynamicColor',
        text: '动态颜色变换',
        component: () => import('@/views/cesium/dynamicColor/dynamicColor.vue')
      },
      {
        path: '/showGrid',
        name: 'showGrid',
        text: '显示网格',
        component: () => import('@/views/cesium/showGrid/showGrid.vue')
      },
      {
        path: '/supermap',
        name: 'supermap',
        text: 'supermap',
        component: () => import('@/views/supermap/supermap.vue')
      },
      {
        path: '/baseShape',
        name: 'baseShape',
        text: '基础形状',
        component: () => import('@/views/draw/baseShape/baseShape.vue')
      },
      {
        path: '/elementStyles',
        name: 'elementStyles',
        text: '获取元素样式值',
        component: () => import('@/views/draw/elementStyles/elementStyles.vue')
      }
    ]
  }
]

const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

const router = new VueRouter({
  base: process.env.BASE_URL,
  routes
})

export default router
